package Application

import "fmt"

func IntersectionIntTwoDimension(in, out [2]int) (res [2]int, ok bool) {
	if in[1] < out[0] || in[0] > out[1] || in[0] > in[1] || out[0] > out[1] {
		return
	}
	ok = true
	if in[0] < out[0] {
		if in[1] > out[1] {
			res[0], res[1] = out[0], out[1]
		} else if in[1] > out[0] {
			res[0], res[1] = out[0], in[1]
		} else {
			return res, false
		}
	} else {
		if in[1] < out[1] {
			res[0], res[1] = in[0], in[1]
		} else if out[1] > in[0] {
			res[0], res[1] = in[0], out[1]
		} else {
			return res, false
		}
	}
	return res, true
}
func TEs() {
	in := [2]int{1, 5}
	out := [2]int{2, 6}
	res, ok := IntersectionIntTwoDimension(in, out)
	fmt.Println(res)
	fmt.Println(ok)
}
